<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		parent.$.messager.progress('close');
		$('#form')
				.form(
						{
							url : '${pageContext.request.contextPath}/accountController/hqtr?id=${account.id}',
							onSubmit : function() {
								parent.$.messager.progress({
									title : '提示',
									text : '数据处理中，请稍后....'
								});
								var isValid = $(this).form('validate');
								if (!isValid) {
									parent.$.messager.progress('close');
								}
								return isValid;
							},
							success : function(result) {
								parent.$.messager.progress('close');
								result = $.parseJSON(result);
								if (result.success) {
									parent.$.messager.alert('成功', result.msg,
											'info');

									parent.$.modalDialog.openner_dataGrid
											.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
									parent.$.modalDialog.handler
											.dialog('close');
									$('#accountdialog').dialog('refresh');
									$('#acmndialog').dialog('refresh');
								} else {
									parent.$.messager.alert('错误', result.msg,
											'error');
								}
							}
						});
	});

	$.extend($.fn.validatebox.defaults.rules, { //验证密码
		isac : {
			validator : function(value) {
				var patrn = /^[1-5]\d*$/;
				if (!patrn.exec(value)) {
					return false;
				}
				if (parseInt(parseInt(value) / 1000) % 10 != 1) {
					return false;
				}
				if (parseInt(value) / 10000> 5) {
					return false;
				}
				return true;
			},
			message : "必须是合法的账户号."
		},
		isykt : {
			validator : function(value2) {
				var patrn2 = /^1\w{9}$/;
				if (!patrn2.exec(value2)) {
					return false;
				}
				return true;
			},
			message : "必须是合法的一卡通号."
		}
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title=""
		style="overflow: hidden;">
		余额:${account.amount}<br /> <span style="color:red">*请填写目标活期账户*
		</span>
		<form id="form" method="post">
			<table class="table table-hover table-condensed">
				<tr>
					<th>对方一卡通号</th>
					<td><input name="uname" type="text"
						class="easyui-validatebox span2"
						data-options="length:[10,10],required:true,validType:['isykt']"></td>
					<th>子账号</th>
					<td><input name="toacname" type="text"
						class="easyui-validatebox span2"
						data-options="length:[5,5],required:true,validType:['isac']"></td>
				</tr>
				<tr>
					<th>转账金额</th>
					<td><input name="changevalue" class="easyui-numberbox span2"
						value="1" data-options="min:0,max:${account.amount},precision:2" /></td>
				</tr>
			</table>
		</form>
	</div>
</div>